﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetTopologySuite.Noding;
using static Coldairarrow.Entity.Interface.LX_Rate;
using System.Runtime.Intrinsics.X86;
using NetTopologySuite.Geometries;
using static Coldairarrow.Entity.Interface.PL_Feeder;

namespace Coldairarrow.Entity.Interface
{
    /// <summary>
    /// 订单明细
    /// </summary>
    /// 

    public class XM_OrderLIst
    {
        public int code { get; set; }
        public Data data { get; set; }

        public class Data
        {
            public int total { get; set; }
            public int pageNo { get; set; }

            public List<OrderList> orderList { get; set; }

        }

        public class OrderList
        {
            public string ID { get; set; }
            public string RowId { get; set; }
            /// <summary>
            /// 订单ID
            /// </summary>
            public string orderId { get; set; }
            /// <summary>
            /// 换货单原单单号，见文档常见问题
            /// </summary>
            public string originOrderId { get; set; }
            /// <summary>
            /// // 订单渠道："YOUPIN"-有品商城订单, "VMI"-VMI渠道订单
            /// </summary>
            public string channel_;
            public string channel
            {
                get { return channel_; }

                set
                {
                    if (value == "YOUPIN") channel_ = "有品商城订单";
                    else if (value == "VMI") channel_ = "VMI渠道订单";
                    else channel_ = value;
                }

            }
            /// <summary>
            /// 订单类型 6-有品普通订单, 13-普通众筹, 16-定金预售订单, 17-海淘跨境, 18-收单订单（外平台或活动）, 19-虚拟商品订单, 23-换货单, 24-补件单, 25-盲售单
            /// </summary>
            public string orderType_;
            public string orderType
            {
                get { return orderType_; }

                set
                {
                    if (value == "6") orderType_ = "有品普通订单";
                    else if (value == "13") orderType_ = "普通众筹";
                    else if (value == "16") orderType_ = "定金预售订单";
                    else if (value == "17") orderType_ = "海淘跨境";
                    else if (value == "18") orderType_ = "收单订单";
                    else if (value == "19") orderType_ = "虚拟商品订单";
                    else if (value == "23") orderType_ = "换货单";
                    else if (value == "24") orderType_ = "补件单";
                    else if (value == "25") orderType_ = "盲售单";
                    else orderType_ = value;
                }

            }
            /// <summary>
            /// 用户id
            /// </summary>
            public string uid { get; set; }
            /// <summary>
            /// 商户ID, 同公共参数里的partnerId
            /// </summary>
            public string partnerId { get; set; }
            /// <summary>
            /// 订单创建时间，时间戳（秒）
            /// </summary>
            public string ctime { get; set; }
            /// <summary>
            /// 订单支付时间，时间戳（秒）
            /// </summary>
            public string ftime { get; set; }
            /// <summary>
            /// 发货主体 (65为有品配送，非65为商家自发)
            /// </summary>
            public string consignor { get; set; }
            /// <summary>
            /// 订单用户备注
            /// </summary>
            public string description { get; set; }
            /// <summary>
            /// 订单收货人信息
            /// </summary>
            public Address address { get; set; }


            /// <summary>
            /// 国家
            /// </summary>
            public string address_country { get; set; }
            /// <summary>
            /// 省份
            /// </summary>
            public string address_province { get; set; }
            /// <summary>
            /// 市/县
            /// </summary>
            public string address_city { get; set; }
            /// <summary>
            /// 城区
            /// </summary>
            public string address_district { get; set; }
            /// <summary>
            /// 街道地址
            /// </summary>
            public string address_area { get; set; }
            /// <summary>
            /// 地址
            /// </summary>
            public string address_address { get; set; }
            /// <summary>
            /// 地址ID
            /// </summary>
            public string address_addressId { get; set; }
            /// <summary>
            /// 地址名称
            /// </summary>
            public string address_addressName { get; set; }
            /// <summary>
            /// 收货人
            /// </summary>
            public string address_consignee { get; set; }
            /// <summary>
            /// 电话
            /// </summary>
            public string address_tel { get; set; }
            /// <summary>
            /// 邮编
            /// </summary>
            public string address_zipcode { get; set; }
            /// <summary>
            /// 新增时间
            /// </summary>
            public string address_addTime { get; set; }
            /// <summary>
            /// 更新时间
            /// </summary>
            public string address_updateTime { get; set; }

            public class Address
            {
                /// <summary>
                /// 国家
                /// </summary>
                public Location country { get; set; }
                /// <summary>
                /// 省份
                /// </summary>
                public Location province { get; set; }
                /// <summary>
                /// 市/县
                /// </summary>
                public Location city { get; set; }
                /// <summary>
                /// 城区
                /// </summary>
                public Location district { get; set; }
                /// <summary>
                /// 街道地址
                /// </summary>
                public Location area { get; set; }
                /// <summary>
                /// 地址
                /// </summary>
                public string address { get; set; }
                /// <summary>
                /// 地址ID
                /// </summary>
                public string addressId { get; set; }
                /// <summary>
                /// 地址名称
                /// </summary>
                public string addressName { get; set; }
                /// <summary>
                /// 收货人
                /// </summary>
                public string consignee { get; set; }
                /// <summary>
                /// 电话
                /// </summary>
                public string tel { get; set; }
                /// <summary>
                /// 邮编
                /// </summary>
                public string zipcode { get; set; }
                /// <summary>
                /// 新增时间
                /// </summary>
                public string addTime { get; set; }
                /// <summary>
                /// 更新时间
                /// </summary>
                public string updateTime { get; set; }
            }

            public class Location
            {

                public string id { get; set; }
                public string name { get; set; }

            }

            /// <summary>
            /// 用户身份证信息(跨境电商专用)
            /// </summary>
            public ConsigneeIdCard consigneeIdCard { get; set; }

            /// <summary>
            /// 身份证号
            /// </summary>
            public string consigneeIdCard_cardId { get; set; }
            /// <summary>
            /// 身份证姓名
            /// </summary>
            public string consigneeIdCard_cardName { get; set; }
            public class ConsigneeIdCard
            {
                /// <summary>
                /// 身份证号
                /// </summary>
                public string cardId { get; set; }
                /// <summary>
                /// 身份证姓名
                /// </summary>
                public string cardName { get; set; }

            }

            /// <summary>
            /// 支付信息 跨境电商专用
            /// </summary>
            public PaymentInfo paymentInfo { get; set; }
            /// <summary>
            /// 保税仓金控订单支付类型
            /// </summary>
            public string paymentInfo_importationType { get; set; }
            public class PaymentInfo
            {
                /// <summary>
                /// 保税仓金控订单支付类型
                /// </summary>
                public List<string> importationType { get; set; }

            }

            /// <summary>
            /// 订单优惠券扣减金额（分）
            /// </summary>
            public decimal couponReduce { get; set; }
            /// <summary>
            /// 订单活动扣减金额（分）
            /// </summary>
            public decimal activityReduce { get; set; }
            /// <summary>
            /// 订单红包扣减金额 （分）
            /// </summary>
            public decimal redpacketReduce { get; set; }
            /// <summary>
            /// 订单运费（分）
            /// </summary>
            public decimal shipFee { get; set; }
            /// <summary>
            /// 订单支付总价（包含运费）（分）
            /// </summary>
            public decimal totalPrice { get; set; }
            /// <summary>
            /// 发票抬头
            /// </summary>
            public string invoiceTitle { get; set; }
            /// <summary>
            /// 发票类型
            /// </summary>
            public string invoiceType_;
            public string invoiceType
            {
                get { return invoiceType_; }

                set
                {
                    if (value == "0") invoiceType_ = "无发票";
                    else if (value == "1") invoiceType_ = "个人纸质普票";
                    else if (value == "2") invoiceType_ = "企业纸质普票";
                    else if (value == "4") invoiceType_ = "电子发票";
                    else if (value == "5") invoiceType_ = "个人电子普票";
                    else if (value == "6") invoiceType_ = "企业电子普票";

                    else invoiceType_ = value;
                }

            }
            /// <summary>
            /// 税号
            /// </summary>
            public string invoiceCompanyCode { get; set; }
            /// <summary>
            /// 发票开具通知号码
            /// </summary>
            public string invoicePhone { get; set; }
            /// <summary>
            /// 发票开具通知邮箱
            /// </summary>
            public string invoiceEmail { get; set; }
            /// <summary>
            /// 订单购买的产品详情列表
            /// </summary>
            public List<ProductList> productList { get; set; }
            /// <summary>
            /// ugId
            /// </summary>
            public string productList_ugId { get; set; }
            /// <summary>
            /// 商品GID
            /// </summary>
            public string productList_gid { get; set; }
            /// <summary>
            /// 产品PID
            /// </summary>
            public string productList_pid { get; set; }
            /// <summary>
            /// pid商品名称
            /// </summary>
            public string productList_name { get; set; }
            /// <summary>
            /// 该pid商品数量
            /// </summary>
            public string productList_count { get; set; }
            /// <summary>
            /// 订单商品状态
            /// </summary>
            public string productList_status { get; set; }
            /// <summary>
            /// 套装pid
            /// </summary>
            public string productList_packagePid { get; set; }
            /// <summary>
            /// 套装购买数量
            /// </summary>
            public string productList_packageCount { get; set; }
            /// <summary>
            /// 套装名称
            /// </summary>
            public string productList_packageName { get; set; }
            /// <summary>
            /// 商品虚拟类型: 0-实物, 1-安装服务, 2-会员
            /// </summary>
            public string productList_virtualType { get; set; }
            /// <summary>
            /// 商品所属的商户ID
            /// </summary>
            public string productList_merchantId { get; set; }
            /// <summary>
            /// 产品支付价格
            /// </summary>
            public decimal productList_price { get; set; }
            /// <summary>
            /// 下单时该商品售卖价格(券优惠，红包以及其他非直降类活动优惠的基准价格)
            /// </summary>
            public decimal productList_salePrice { get; set; }
            /// <summary>
            /// 原价（市场价）
            /// </summary>
            public decimal productList_productPrice { get; set; }
            /// <summary>
            /// 商品分摊运费
            /// </summary>
            public decimal productList_expressAvFee { get; set; }

            /// <summary>
            /// 组合产品子产品SKU*数量
            /// </summary>
            public string productList_skuInfoList_sku { get; set; }

            /// <summary>
            /// 商品GID
            /// </summary>
            public List<SkuInfoList> skuInfoList { get; set; }




            /// <summary>
            /// 商品定制信息
            /// </summary>
            public string customizedInfo { get; set; }
            /// <summary>
            /// 承诺发货时间
            /// </summary>
            public string promiseDeliveryTime { get; set; }

            public class ProductList
            {
                /// <summary>
                /// ugId
                /// </summary>
                public string ugId { get; set; }
                /// <summary>
                /// 商品GID
                /// </summary>
                public string gid { get; set; }
                /// <summary>
                /// 产品PID
                /// </summary>
                public string pid { get; set; }
                /// <summary>
                /// pid商品名称
                /// </summary>
                public string name { get; set; }
                /// <summary>
                /// 该pid商品数量
                /// </summary>
                public string count { get; set; }
                /// <summary>
                /// 订单商品状态
                /// </summary>
                public string status_;
                public string status
                {
                    get { return status_; }

                    set
                    {
                        if (value == "4") status_ =       "已支付";
                        else if (value == "6") status_ =  "已发货";
                        else if (value == "50") status_ = "已完成";
                        else if (value == "17") status_ = "申请退款";
                        else if (value == "37") status_ = "退款中";
                        else if (value == "39") status_ = "退款完成";
                        else if (value == "18") status_ = "订单取消";
                        else if (value == "45") status_ = "待服务";
                        else if (value == "46") status_ = "服务中";
                        else status_ = value;
                    }

                }
                /// <summary>
                /// 套装pid
                /// </summary>
                public string packagePid { get; set; }
                /// <summary>
                /// 套装购买数量
                /// </summary>
                public string packageCount { get; set; }
                /// <summary>
                /// 套装名称
                /// </summary>
                public string packageName { get; set; }
                /// <summary>
                /// 商品虚拟类型: 0-实物, 1-安装服务, 2-会员
                /// </summary>
                public string virtualType_;
                public string virtualType
                {
                    get { return virtualType_; }

                    set
                    {
                        if (value == "0") virtualType_ = "实物";
                        else if (value == "1") virtualType_ = "安装服务";
                        else if (value == "2") virtualType_ = "会员";
                        else virtualType_ = value;
                    }

                }
                /// <summary>
                /// 商品所属的商户ID
                /// </summary>
                public string merchantId { get; set; }
                /// <summary>
                /// 产品支付价格
                /// </summary>
                public decimal price { get; set; }
                /// <summary>
                /// 下单时该商品售卖价格(券优惠，红包以及其他非直降类活动优惠的基准价格)
                /// </summary>
                public decimal salePrice { get; set; }
                /// <summary>
                /// 原价（市场价）
                /// </summary>
                public decimal productPrice { get; set; }
                /// <summary>
                /// 商品分摊运费
                /// </summary>
                public decimal expressAvFee { get; set; }


                /// <summary>
                /// 商品GID
                /// </summary>
                public List<SkuInfoList> skuInfoList { get; set; }

                


                /// <summary>
                /// 商品定制信息
                /// </summary>
                public string customizedInfo { get; set; }
                /// <summary>
                /// 承诺发货时间
                /// </summary>
                public string promiseDeliveryTime { get; set; }
                

            }
            public class SkuInfoList
            {
                /// <summary>
                /// pid
                /// </summary>
                public string pid { get; set; }
                /// <summary>
                /// skuid
                /// </summary>
                public string skuId { get; set; }
                /// <summary>
                /// 单个pid对应的skuid 数量
                /// </summary>
                public decimal count { get; set; }

            }
            /// <summary>
            /// 物流信息
            /// </summary>
            public List<LogisticsList> logisticsList { get; set; }

            /// <summary>
            /// 快递代码
            /// </summary>
            public string LogisticsList_bizCode { get; set; }
            /// <summary>
            /// 快递公司
            /// </summary>
            public string LogisticsList_companyName { get; set; }
            /// <summary>
            /// 快递单号
            /// </summary>
            public string LogisticsList_expressSn { get; set; }
            /// <summary>
            /// 配送时间
            /// </summary>
            public string LogisticsList_deliveryTime { get; set; }
            /// <summary>
            /// 收货时间
            /// </summary>
            public string LogisticsList_acceptTime { get; set; }

            /// <summary>
            /// 包裹产品
            /// </summary>
            public List<SkuInfoList> itemList { get; set; }
            public class LogisticsList
            {
                /// <summary>
                /// 快递代码
                /// </summary>
                public string bizCode { get; set; }
                /// <summary>
                /// 快递公司
                /// </summary>
                public string companyName { get; set; }
                /// <summary>
                /// 快递单号
                /// </summary>
                public string expressSn { get; set; }
                /// <summary>
                /// 配送时间
                /// </summary>
                public string deliveryTime { get; set; }
                /// <summary>
                /// 收货时间
                /// </summary>
                public string acceptTime { get; set; }

                /// <summary>
                /// 包裹产品
                /// </summary>
                public List<SkuInfoList> itemList { get; set; }
            }


            /// <summary>
            /// 备注列表
            /// </summary>
            public List<OrderRemarkList> orderRemarkList { get; set; }

            /// <summary>
            /// 备注等级，0-5分别对应蓝、红、橙、黄、绿、紫
            /// </summary>
            public string orderRemarkList_level { get; set; }
            /// <summary>
            /// 备注
            /// </summary>
            public string orderRemarkList_remark { get; set; }
            /// <summary>
            /// 操作人
            /// </summary>
            public string orderRemarkList_userName { get; set; }
            /// <summary>
            /// 创建时间戳，秒级
            /// </summary>
            public string orderRemarkList_createTime { get; set; }
            public class OrderRemarkList
            {
                /// <summary>
                /// 备注等级，0-5分别对应蓝、红、橙、黄、绿、紫
                /// </summary>
                public string level { get; set; }
                /// <summary>
                /// 备注
                /// </summary>
                public string remark { get; set; }
                /// <summary>
                /// 操作人
                /// </summary>
                public string userName { get; set; }
                /// <summary>
                /// 创建时间戳，秒级
                /// </summary>
                public string createTime { get; set; }
                
            }
        }
    }



}
